Skip to content

math:big 一个简单的优化#17

Open
SparrowLii wants to merge 7 commits intoMabinGo:masterfrom
SparrowLii:SparrowLii_0901
Open

math:big 一个简单的优化#17
SparrowLii wants to merge 7 commits intoMabinGo:masterfrom
SparrowLii:SparrowLii_0901

Conversation

@SparrowLii
Copy link
Copy Markdown

用table查找代替了计算过程

测试正确性:
func TESTMaxPow() {
for i := 2; i <= 62; i++ {
b:=Word(i)
p, n := b, 1
for max := (_M) / b; p <= max; {
p *= b
n++
}
pGot,nGot:=maxPow(b)
if p != pGot || n != nGot {
fmt.Errorf("not right!")
}
}
fmt.Println("right")
}
输出: right

Fixes golang#39406
When use checkForResumption() function it could be side-effect sometime.
1. hs.sessionState will be changed and retained although the function return false.
2. hs.suite will be changed and retained when the statements below return false.
So  we should use a local variable, cilentSessionState, to replace hs.sessionState in the function. And move the set-suite statements down to avoid being changed too early.
用table查找代替了计算的过程
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant